package com.harwkin.nb.camera.model;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;

/**
 * 图片的实体类
 */
public class PicsItem implements Serializable {
    private static final long serialVersionUID = 3742779964271677600L;

    public int id;
    public int disid ;
    public String createuser ;
    public String createtime ;
    public String image;

    public static PicsItem deserialize(String json) throws JSONException {
        if (json != null && !json.isEmpty()) {
            return deserialize(new JSONObject(json));
        }
        return null;
    }

    public static PicsItem deserialize(JSONObject json) throws JSONException {
        if (json != null && json != JSONObject.NULL && json.length() > 0) {
            PicsItem result = new PicsItem();

            result.id = json.optInt("id",-1);

            result.disid = json.optInt("disid",-1);

            result.createuser = json.optString("createuser");

            result.createtime = json.optString("createtime",null);

            result.image = json.optString("image", null);

            return result;
        }
        return null;
    }

}
